package com.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;


@Configuration
@EnableWebMvc
public class MyMVCconfig implements WebMvcConfigurer {
    @Autowired
    private MyInterceptre myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(myInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/ueUploadController/**","/admin/toLogin","/admin/login","/toLogin","/login","/toRegister","/register","/api/**","/delete/**","/update/**","/get/**","/toLogin","/login","/logout","/toUpload","/uploadFile","/download","/static/**")
                .excludePathPatterns("/login.html");
    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        registry.addResourceHandler("/static/**")
                .addResourceLocations("classpath:/static/");
    }

}
